Memory on any computing system is a limited resource. No matter how fast computing systems become, they always depend upon a finite amount of memory in which to run their software applications. As a result, memory limitations are a consideration for software developers when writing and developing software applications.
Some systems deal with memory limitations using automatic memory management. For example, the Java programming language differs from many traditional programming languages (e.g., C and C++) by the way in which memory is allocated and deallocated. In languages like C and C++, memory is explicitly allocated and deallocated by the application programmer/developer. This can greatly increase the time spent by programmers in tracking down coding defects in regards to deallocating memory.
By contrast, the Java runtime environment (e.g., Java virtual machine) provides a built-in mechanism for allocating and deallocating memory. In Java, memory is allocated to objects. The Java virtual machine (“VM” or “JVM”) automatically handles the amount and allocation of memory upon an object's creation. The Java runtime environment employs a “garbage collector” to reclaim the memory allocated to an object that is no longer needed. Once the garbage collector determines that the object is no longer accessible (e.g., when there is no longer any references to it stored in any variables, the fields of objects, or the elements of any arrays, etc.), it reclaims the allocated memory. When objects in a Java application are no longer referenced, the heap space the object occupied is to be recycled so that the space becomes available for subsequently-created objects.